

function getJsApiConfig() {
    var url = window.location.href.split('#')[0];
    var referee = $("#referee").val();
    var link = 'http://' + window.location.host + Think.U('Public/register', 'referee='+referee);
    $requestURL = Think.U('WeChatApi/getApiConfig');

    $.post($requestURL, {currentURL:url}, function(data){
		
    	if (data.status == 1) {
    		
    		var token = data.info.token;
    		
    		wx.config({
    		      debug: false,
    		      appId: data.info.appid,
    		      timestamp: data.info.timestamp,
    		      nonceStr: data.info.nonceStr,
    		      signature: data.info.signature,
    		      jsApiList: [
    		        'onMenuShareTimeline',
    		        'onMenuShareAppMessage',
    		        'showMenuItems',
    		        'hideMenuItems'
    		      ]
    		});

    		wx.ready(function () {
    				
    				wx.showMenuItems({
    				    menuList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
    				});
    				
    				wx.onMenuShareTimeline({
    				    title: '帮工小哥', // 分享标题
    				    link: link, 	// 分享链接
    				    imgUrl: 'http://x71.bloveoa.com/Public/Api/images/tuijianyoujiang.png', // 分享图标
    				    success: function () { 
    				    },
    				    cancel: function () { 
    				    }
    				});
    				
    				wx.onMenuShareAppMessage({
    				    title: '帮工小哥', // 分享标题
    				    desc: '帮工小哥只为帮', // 分享描述
    				    link: link, // 分享链接
    				    imgUrl: 'http://x71.bloveoa.com/Public/Api/images/tuijianyoujiang.png', // 分享图标
    				    success: function () { 
    				    },
    				    cancel: function () { 
    				    }
    				});
    		})
		}else{
			
			alert(data.msg);
		}
	});
}
